package com.daniu.eureka.client.controller;

import com.daniu.eureka.client.api.user.UserFeignService;
import com.daniu.eureka.client.api.user.dto.UserDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserBController {

    @Autowired
    private UserFeignService userFeignService ;

    @RequestMapping(value = "/", method = RequestMethod.POST)
    public String createUser(@RequestParam("name") String name, @RequestParam("age") Integer age) {
        UserDTO user = new UserDTO();
        user.setAge(age);
        user.setName(name);
        return userFeignService.createUser(user);
    }


}
